package leetcode;

import java.util.*;


public class leecode485 {
    public static void main(String[] args) {
        Solution solution = new Solution();
        Scanner sc=new Scanner(System.in);
        int[] arr = {};
        for (int i:arr){

        }

        System.out.println(solution.findNumberOfConsecutiveOnes(arr));
        /**
         * 输入一个字符串，在该字符串中，以每个空格为分界线把各个元素按照字符数组的形式返回
         */


    }
    static class Solution {
        public int findNumberOfConsecutiveOnes(int[] arr) {
            if (arr == null || arr.length == 0) {
                return 0;
            }
            int count = 0;
            int result = 0;
            for (int i =0;i< arr.length;i++) {
                if (arr[i] == 1) {
                    count++;

                } else {
                    result = Math.max(result,count);
                    count=0;
                }
            }
            return Math.max(result,count);
        }
    }
}


